﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LoU.Dungeons
{
    public static class Data
    {
        private static double GOLD_RATIO = 0.26;

        public static Dictionary<DungeonType, double> LootPerDamage = new Dictionary<DungeonType, double> {
            { DungeonType.Forest, 15.2 },
            { DungeonType.Hill, 14.6 },
            { DungeonType.Mountain, 14.2 },
            { DungeonType.Sea, 12.855 },
        };

        public static Dictionary<DungeonType, double> LootPerDamageHigh = new Dictionary<DungeonType, double> {
            { DungeonType.Forest, 32.5 },
            { DungeonType.Hill, 28.0 },
            { DungeonType.Mountain, 28.5 },
            { DungeonType.Sea, 25.71 },
        };

        public static Dictionary<DungeonType, AttackType> Vulnerabilities = new Dictionary<DungeonType, AttackType> {
            { DungeonType.Forest, AttackType.Cavalry },
            { DungeonType.Hill, AttackType.Magic },
            { DungeonType.Mountain, AttackType.Infantry },
            { DungeonType.Sea, AttackType.Artillery },
        };

        public static Dictionary<DungeonType, Dictionary<ResourceType, double>> ResourcesRepartition = new Dictionary<DungeonType, Dictionary<ResourceType, double>>
        {
            { DungeonType.Forest, new Dictionary<ResourceType, double> {
                { ResourceType.Wood, 0.40 },
                { ResourceType.Stone, 0.16 },
                { ResourceType.Iron, 0.24 },
                { ResourceType.Food, 0.20 },
                { ResourceType.Gold, GOLD_RATIO },
            } },
            { DungeonType.Hill, new Dictionary<ResourceType, double> {
                { ResourceType.Wood, 0.20 },
                { ResourceType.Stone, 0.36 },
                { ResourceType.Iron, 0.24 },
                { ResourceType.Food, 0.20 },
                { ResourceType.Gold, GOLD_RATIO },
            } },
            { DungeonType.Mountain, new Dictionary<ResourceType, double> {
                { ResourceType.Wood, 1.0 / 6.0 },
                { ResourceType.Stone, 0.10 },
                { ResourceType.Iron, 17.0 / 30.0 },
                { ResourceType.Food, 1.0 / 6.0 },
                { ResourceType.Gold, GOLD_RATIO },
            } },
            { DungeonType.Sea, new Dictionary<ResourceType, double> {
                { ResourceType.Wood, 0.3 },
                { ResourceType.Stone, 0.15 },
                { ResourceType.Iron, 0.3 },
                { ResourceType.Food, 0.25 },
                { ResourceType.Gold, GOLD_RATIO },
            } },
        };

        public static Dictionary<UnitType, Unit> Units = new Dictionary<UnitType, Unit>
        {
            { UnitType.Berserker, new Unit { Attack = 50, CC = 10, DailyFoodCost = 6, AttackType = AttackType.Infantry,
                RecruitCost = new Resources 
                {
                    { ResourceType.Iron, 150 },
                }
            } },
            { UnitType.Ranger, new Unit { Attack = 30, CC = 10, DailyFoodCost = 3, AttackType = AttackType.Infantry,
                RecruitCost = new Resources 
                {
                    { ResourceType.Wood, 160 },
                }
            } },
            { UnitType.Gardian, new Unit { Attack = 10, CC = 20, DailyFoodCost = 3, AttackType = AttackType.Infantry,
                RecruitCost = new Resources 
                {
                    { ResourceType.Iron, 140 },
                    { ResourceType.Gold, 40 },
                }
            } },
            { UnitType.Paladin, new Unit { Attack = 30, CC = 10, DailyFoodCost = 7.5, AttackType = AttackType.Cavalry,
                RecruitCost = new Resources 
                {
                    { ResourceType.Iron, 100 },
                    { ResourceType.Gold, 80 },
                }
            } },
            { UnitType.Templar, new Unit { Attack = 25, CC = 10, DailyFoodCost = 3, AttackType = AttackType.Infantry,
                RecruitCost = new Resources 
                {
                    { ResourceType.Iron, 90 },
                    { ResourceType.Gold, 100 },
                }
            } },
            { UnitType.Knight, new Unit { Attack = 45, CC = 7.5, DailyFoodCost = 3, AttackType = AttackType.Cavalry,
                RecruitCost = new Resources 
                {
                    { ResourceType.Iron, 125 },
                    { ResourceType.Gold, 50 },
                }
            } },
            { UnitType.Mage, new Unit { Attack = 70, CC = 5, DailyFoodCost = 5, AttackType = AttackType.Magic,
                RecruitCost = new Resources 
                {
                    { ResourceType.Iron, 50 },
                    { ResourceType.Gold, 150 },
                }
            } },
            { UnitType.Warlock, new Unit { Attack = 60, CC = 5, DailyFoodCost = 10, AttackType = AttackType.Magic,
                RecruitCost = new Resources 
                {
                    { ResourceType.Iron, 100 },
                    { ResourceType.Gold, 350 },
                }
            } },
            { UnitType.Crossbowman, new Unit { Attack = 20, CC = 7.5, DailyFoodCost = 5, AttackType = AttackType.Cavalry,
                RecruitCost = new Resources 
                {
                    { ResourceType.Wood, 75 },
                    { ResourceType.Gold, 100 },
                }
            } },
            { UnitType.Sloop, new Unit { Attack = 12, CC = 15, DailyFoodCost = 3, AttackType = AttackType.Artillery,
                RecruitCost = new Resources 
                {
                    { ResourceType.Wood, 60 },
                    { ResourceType.Iron, 40 },
                    { ResourceType.Gold, 20 },
                }
            } },
            { UnitType.Frigate, new Unit { Attack = 30, CC = 10, DailyFoodCost = 5, AttackType = AttackType.Artillery,
                RecruitCost = new Resources 
                {
                    { ResourceType.Wood, 150 },
                    { ResourceType.Iron, 50 },
                    { ResourceType.Gold, 50 },
                }
            } },
            { UnitType.WarGalleon, new Unit { Attack = 30, CC = 7.5, DailyFoodCost = 6.25, AttackType = AttackType.Artillery,
                RecruitCost = new Resources 
                {
                    { ResourceType.Wood, 75 },
                    { ResourceType.Iron, 25 },
                    { ResourceType.Gold, 50 },
                }
            } },
        };

        public static MilitaryBuild[] CastleBuilds = new MilitaryBuild[]
        {
            // TG castle builds
            new MilitaryBuild(4, 5, 6, 312),
            new MilitaryBuild(3, 4, 5, 296),
            new MilitaryBuild(3, 4, 4, 284),
            new MilitaryBuild(3, 3, 4, 276),
            new MilitaryBuild(2, 3, 4, 260),
            new MilitaryBuild(2, 3, 3, 252),
            new MilitaryBuild(2, 2, 3, 224),
            new MilitaryBuild(2, 2, 2, 188),
            new MilitaryBuild(1, 2, 2, 136),

            //// TG City builds
            //new MilitaryBuild(4, 5, 6, 81),
            //new MilitaryBuild(4, 4, 5, 78),
            //new MilitaryBuild(3, 4, 5, 77),
            //new MilitaryBuild(3, 4, 4, 74),
            //new MilitaryBuild(3, 3, 4, 72),
            //new MilitaryBuild(2, 3, 4, 68),
            //new MilitaryBuild(2, 3, 3, 66),
            //new MilitaryBuild(2, 2, 3, 60),
            //new MilitaryBuild(2, 2, 2, 51),
            //new MilitaryBuild(1, 2, 2, 42),
            

            // other builds
            new MilitaryBuild(UnitType.Paladin, 5.5, 292),
            new MilitaryBuild(UnitType.Paladin, 5, 280),
            new MilitaryBuild(UnitType.Paladin, 4.5, 272),
            new MilitaryBuild(UnitType.Paladin, 4, 256),
            new MilitaryBuild(UnitType.Paladin, 3.5, 236),
            new MilitaryBuild(UnitType.Paladin, 3, 212),

            new MilitaryBuild(UnitType.Templar, 5, 288),
            new MilitaryBuild(UnitType.Templar, 4, 264),
            new MilitaryBuild(UnitType.Templar, 3, 228),

            new MilitaryBuild(UnitType.Knight, 4, 292),
            new MilitaryBuild(UnitType.Knight, 3.5, 280),
            new MilitaryBuild(UnitType.Knight, 3, 264),
            new MilitaryBuild(UnitType.Knight, 2.5, 244),

            new MilitaryBuild(UnitType.Mage, 9, 300),
            new MilitaryBuild(UnitType.Mage, 8, 288),
            new MilitaryBuild(UnitType.Mage, 7, 272),
            new MilitaryBuild(UnitType.Mage, 6, 252),
            new MilitaryBuild(UnitType.Mage, 5, 224),

            new MilitaryBuild(UnitType.Warlock, 7.5, 268),
            new MilitaryBuild(UnitType.Warlock, 7, 256),
            new MilitaryBuild(UnitType.Warlock, 6.5, 248),
            new MilitaryBuild(UnitType.Warlock, 6, 232),
            new MilitaryBuild(UnitType.Warlock, 5.5, 216),

            new MilitaryBuild(UnitType.Crossbowman, 5, 296),
            new MilitaryBuild(UnitType.Crossbowman, 4.5, 288),
            new MilitaryBuild(UnitType.Crossbowman, 4, 276),
            new MilitaryBuild(UnitType.Crossbowman, 3.5, 260),
            new MilitaryBuild(UnitType.Crossbowman, 3, 240),

            // low % recruit speed research / faith
            new MilitaryBuild(UnitType.Sloop, 13, 328),
            new MilitaryBuild(UnitType.Frigate, 21, 328),
            new MilitaryBuild(UnitType.WarGalleon, 11, 328),

            // 100% recruit speed research / faith
            new MilitaryBuild(UnitType.Sloop, 7, 328),
            new MilitaryBuild(UnitType.Frigate, 11, 328),
            new MilitaryBuild(UnitType.WarGalleon, 6, 328),
        };
    }
}
